#ifndef STATEEMEGRENCY_H
#define STATEEMERGENCY_H

#include "state.h"
#include "../properties.h"

namespace state {

struct Emergency : public State {
	Emergency(int id) : State(id) {}
	
	virtual void onEnter() {
		PropAccessor p;
		p().fcs.roll.set(Roll_SetPoint, 0);
		p().fcs.pitch.set(Pitch_VSpeed, -3.0f);
		p().fcs.yaw.set(Yaw_Damper);
		p().fcs.throttle.set(Throttle_Value, -1);
		p().fcs.flaps.set(Flaps_Value, Flaps_Value_Takeoff);

		p().fcs.parachute = true;

		p().fcs.watcher = Watcher_Idle;
		
		p().fcs.state = getId();
	}
};

}

#endif
